import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '../layout/index'
Vue.use(VueRouter)

const constantRoutes = [
  {
    path: '/login',
    component: () => import('../views/login.vue'),
    name: 'login'
  },

  // 首页
  {
    path: '/',
    component: Layout,
    redirect: '/welcome',
    children: [
      {
        path: 'welcome',
        component: () => import('../views/welcome.vue'),
        name: 'welcome'
      }
    ]
  },

  // 文档说明
  {
    path: '/document',
    component: Layout,
    children: [
      {
        path: '/index',
        component: () => import('../views/document/index.vue'),
        name: 'document'
      }
    ]
  },

  // 系统管理
  {
    path: '/system',
    component: Layout,
    children: [
      {
        path: '/users',
        component: () => import('../views/system/users/index.vue'),
        name: 'users'
      },
      {
        path: '/roles',
        component: () => import('../views/system/roles/index.vue'),
        name: 'roles'
      },
      {
        path: '/menus',
        component: () => import('../views/system/menus/index.vue'),
        name: 'menus'
      }
    ]
  }

  // {
  //   path: '/content',
  //   component: Layout,
  //   children: [
  //     {
  //       path: '/release',
  //       component: () => import('../views/content/release/index.vue')
  //     },
  //     {
  //       path: '/artList',
  //       component: () => import('../views/content/artList/index.vue')
  //     }
  //   ]
  // }
]

const router = new VueRouter({
  // base: '/home/',
  // mode: 'history',
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRoutes
})

export default router
